var mysql = require('mysql')
var pool = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: '123456',
    database: 'order'
})
const query = async (sql, params) => {
  return await new Promise((resolve, reject) => {
    pool.query(sql, params, function (err, res) {
      if (err) {
        reject(err)
      } else {
        resolve(res)
      }
    })
  })
}

module.exports = query
